function $_(obj)
{
	return document.getElementById(obj);
}

function getOuterHTML(obj)
{
	var div = document.createElement('div');
	div.appendChild(obj.cloneNode(1));
	return div.innerHTML;
}

function load_admin()
{
	load('view/js/admin.js.css');
	load('js.php?p=admin');
}

function load_login()
{
	load('view/js/login.js.css');
	load('js.php?p=login');
}

function load(url,css)
{
	var ext = url.substring(url.length-4,url.length);
	var head = document.getElementsByTagName('head');
	head = head[0];
	if (ext.toLowerCase() == '.css' || css)
	{
		var dom = document.createElement('link');
		dom.rel = "stylesheet";
		dom.href = url;
	}
	else 
	{
		var dom = document.createElement('script');
		dom.src = url;
	}
	head.appendChild(dom);
}

function get_value_from_url(url,key)
{
	eval('var re = /'+key+'=([^&]*)/;');
	re = re.exec(url);
	if (re) return re[1];
}



function fixPng() {
  var arVersion = navigator.appVersion.split("MSIE")
  var version = parseFloat(arVersion[1])

  if ((version >= 5.5 && version < 7.0) && (document.body.filters)) {
    for(var i=0; i<document.images.length; i++) {
      var img = document.images[i];
      var imgName = img.src.toUpperCase();
      if (imgName.indexOf(".PNG") > 0) {
        var width = img.width;
        var height = img.height;
        var sizingMethod = (img.className.toLowerCase().indexOf("scale") >= 0)? "scale" : "image"; 
        img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.src.replace('%23', '%2523').replace("'", "%27") + "', sizingMethod='" + sizingMethod + "')";
        img.src = "images/blank.gif";
        img.width = width;
        img.height = height;
        }
      }
    }
  }


window.refresh = function()
{
	var url = window.location.toString().replace(/&?\??randomt=\d{1,}/,'');
	url+= (url.indexOf('?') == -1)?'?':'&';
	url += 'randomt='+parseInt(Math.random()*10000);
	window.location = url;
}